﻿using System;
using System.Collections.Generic;
using System.Text;

namespace DotNetStar.OpenSDK.QQ
{
    /// <summary>
    /// 获取已登录用户的关于QQ会员业务的详细资料的 api 响应结果。
    /// </summary>
    /// <seealso cref="OpenSDK.QQ.QQInformationApiResponse" />
    public class QQVipRichInfoApiResponse : QQInformationApiResponse
    {
        /// <summary>
        /// 初始化 <see cref="QQVipRichInfoApiResponse"/> 类的新实例。
        /// </summary>
        public QQVipRichInfoApiResponse()
        {
        }
        /// <summary>
        /// 标识是否QQ会员（0：不是； 1：是）
        /// </summary>
        public int Is_qq_vip { get; set; }
        /// <summary>
        /// QQ会员最后一次充值时间
        /// </summary>
        public int QQ_vip_start { get; set; }
        /// <summary>
        /// QQ会员期限
        /// </summary>
        public int QQ_vip_end { get; set; }
        /// <summary>
        /// QQ会员充值方式
        /// </summary>
        public int QQ_vip_payway { get; set; }
        /// <summary>
        /// QQ年费会员最后一次充值时间
        /// </summary>
        public int QQ_year_vip_start { get; set; }
        /// <summary>
        /// QQ年费会员期限
        /// </summary>
        public int QQ_year_vip_end { get; set; }
        /// <summary>
        /// QQ年费会员充值方式
        /// </summary>
        public int QQ_year_vip_payway { get; set; }
        /// <summary>
        /// QQ钻皇最后一次充值时间
        /// </summary>
        public int QQ_zuanhuang_start { get; set; }
        /// <summary>
        /// QQ钻皇期限
        /// </summary>
        public int QQ_zuanhuang_end { get; set; }
        /// <summary>
        /// QQ钻皇充值方式
        /// </summary>
        public int QQ_zuanhuang_payway { get; set; }

        /// <summary>
        /// 豪华版QQ会员最后一次充值时间
        /// </summary>
        public int QQ_haohua_start { get; set; }
        /// <summary>
        /// 豪华版QQ会员期限
        /// </summary>
        public int QQ_haohua_end { get; set; }
        /// <summary>
        /// 豪华版QQ会员充值方式
        /// </summary>
        public int QQ_haohua_payway { get; set; }

        /// <summary>
        /// QQ SVIP最后一次充值时间，预留字段，当前信息无效
        /// </summary>
        public int QQ_svip_start { get; set; }
        /// <summary>
        /// QQ SVIP期限，预留字段，当前信息无效
        /// </summary>
        public int QQ_svip_end { get; set; }
        /// <summary>
        /// QQ SVIP充值方式，预留字段，当前信息无效
        /// </summary>
        public int QQ_svip_payway { get; set; }
        /// <summary>
        /// 非会员历史充值时间，仅在用户是非会员时信息有效
        /// </summary>
        public int History_pay_time { get; set; }
        /// <summary>
        /// 非会员历史充值到期时间，仅在用户是非会员时信息有效
        /// </summary>
        public int History_end_time { get; set; }

        static Dictionary<int, string> vip_payways = new Dictionary<int, string>()
        {
            [5] = "网银/财付通",
            [100] = "QQ卡",
            [101] = "声讯",
            [102] = "ESALES",
            [103] = "他人赠送",
            [104] = "索要",
            [105] = "公司活动赠送",
            [106] = "免费",
            [107] = "电信卡",
            [108] = "手机充值卡",
            [109] = "广州收费易",
            [110] = "索要",
            [111] = "Q点",
            [112] = "EPAY",
            [113] = "MPAY",
            [114] = "声讯预付费",
            [115] = "拍拍渠道",
            [116] = "申诉返还",
            [117] = "手机ivr",
            [118] = "Q币Q点",
            [119] = "Q点Q币",
        };

        /// <summary>
        /// 获取QQ会员充值方式。http://wiki.connect.qq.com/get_vip_rich_info
        /// </summary>
        /// <param name="payway">充值方式的编号</param>
        /// <returns></returns>
        public string GetVipPayway(int payway)
        {
            if(vip_payways.TryGetValue(payway,out string value))
            {
                return value;
            }
            return "其他渠道";
        }
    }
}
